<?=$this->load->view('user_include_top',null)?>  
<div style="width:100%;padding:5px;">  
<form name="form">
    <div  style="background:white; width:400px; border:#eeeeee 5px solid;  margin: auto">
        <TABLE cellSpacing=5 width=400 height=200>
        <TR>
            <TD height=30 align=center><img src="images/register_title.gif">
            </TD>
        </TR>
         <TR>
            <TD height=30 align=center>用户帐号： <INPUT name=user_name class="color_input" onblur="check_user_name(this.value)">
            </TD>
        </TR>
        <TR>
            <TD height=30 align=center>登录密码： <INPUT name=login_pass  class="color_input" type=password> 
               </TD>
         </TR>
        <TR>
            <TD height=30 align=center>重复密码： <INPUT name=login_pass_2   class="color_input" type=password></TD>
         </TR>
          <TR>
            <TD height=30 align=center>电子邮箱： <INPUT name=email   class="color_input" type=text></TD>
         </TR>
                           <TR>
          <TD height=30 align=center>联系电话： <INPUT name=mobile   class="color_input" type=text></TD>
         </TR>       
          <TR>
            <TD vAlign=top align=center>
                <input type="image" src="images/register_button.gif" onclick="do_register();return false" id="btn_register" style="cursor: pointer;"> <br> <br>
                << <a href="javascript:show_policy();">68visa 服务使用协议</a> >>
                <div id="policy" style='display:none; margin-top: 20px; border-top:dashed 1px gray; padding: 10px;'>this is the policy content of 68visa.com</div>
            </TD>
          </TR>
         </TABLE>
    </div>
</form>
<script>
 var f = document.form;   
          
function do_register() {
   if(f.user_name.value == "") {
       alert('请输入用户帐号!');
       return false; 
   }
   if(f.login_pass.value == "") {
       alert('请输入登录密码!');
       return false; 
   }    
   if(f.login_pass.value != f.login_pass_2.value) {
       alert('登录密码重复不一致!');
       return false;
   } 
   var params = {
       'user_name':f.user_name.value,
       'login_pass':f.login_pass.value,  
       'email':f.email.value,  
       'mobile':f.mobile.value
   } 
   $("#btn_register").val('提交中...');   
   $("#btn_register").attr('disabled', true);
   $.post('user/do_register/', params, function(data){
        if(data == "ok") {
            alert('恭喜已经成功注册为[68visa.com]会员！');
            window.location = "<?=base_url()?>user/login"
        } 
   });
}


function show_policy() {
    $('#policy').show('slow');
}

function check_user_name(v) {
    $.get('user/check_user_name/'+v, function(data){
        if(data == "yes") {
            alert('用户名已存在，请另选！');
            f.user_name.select();
            return false;
        } 
    });
}

</script>
</div>
<?=$this->load->view('user_include_bottom',null)?>     